package com.cy.service;

import com.cy.factory.ServiceDegradationFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.Map;

/**
 * 定义远程实现类,无需写实现类
 */
@FeignClient(name = "sca-provider",
        contextId = "remoteProviderService", //配置别名,相同服务下有许多不同方法
        fallbackFactory = ServiceDegradationFactory.class)  //调用失败后自定义处理异常
public interface RemoteProviderService {
    @GetMapping("/provider/echo/{msg}")
    public String echMg(@PathVariable String msg);

    @PutMapping("/provider/")
    public String doUpdate(@PathVariable Map<String,Object> map);
}
